<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
 </head>
 <body>
  
 </body>
 <script>
   var string = "123456789abcdefg";

   //判断是否有数字
   var pattern_1 = /\D/;
   console.log("判断是否有数字："+pattern_1.test(string));

   //判断是否带有小数
   var str_1 = "12.25";
   var pattern_2 = /^\d+\.\d+$/; 
   console.log("判断是否带有小数："+pattern_2.test(str_1));

   //是否有中文，英文，下划线
   var str_2 = "zhiliaotang_知了堂";
   var pattern_3 = /^[\u4E00-\u9FA5a-zA-Z0-9_]+$/;
   console.log("判断是否有中文，英文，下划线："+pattern_3.test(str_2));
 </script>
</html>
